# In [23]: w=torch.randn(10,784)

# In [24]: logits = x@w.t()

# In [25]: pred = F.softmax(logits,dim=1)

# In [26]: pred_log = torch.log(pred)

# In [27]: F.cross_entropy(logits,torch.tensor([3]))
# Out[27]: tensor(73.4612)

# In [28]: F.nll_loss(pred_log,torch.tensor([3]))
# Out[28]: tensor(73.4612)